from django.db import models

# Create your models here.
class News(models.Model):
    """
    新闻表
    """
    NEWS_TYPE = (
        (1, "BTO"),
        (2, "行业"),
    )

    title = models.CharField(max_length=50, verbose_name='新闻标题', null=False)
    content = models.TextField(max_length=1000, verbose_name='新闻内容', null=False)
    news_type = models.SmallIntegerField(verbose_name='新闻类型', null=False, default=1, choices=NEWS_TYPE)
    pubdate = models.DateTimeField(verbose_name='发布时间', auto_now=True)
    add_time = models.DateTimeField(verbose_name="添加时间", auto_now=True)

    def __str__(self):
        return self.title